package com.ksck.logoDesign.app.network

import android.content.Context
import android.net.ConnectivityManager

/**
 * Created by houzhanlei
 * 2020/7/30
 * 为自己代码负责
 */
/**
 * 判断网络是否可以使用
 * @param context
 * @return 是否可用
 */
fun isNetWorkConnected(context: Context?): Boolean {
    if (null != context) {
        val connectivityManager =
            context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
        val networkInfo = connectivityManager.activeNetworkInfo
        if (null != networkInfo) return networkInfo.isConnected
    }
    return false
}